{{useCss "app-pages/css/main.scss",(["/main.html","/"]) }}
<div class="main_top">
    <div class="box">
        <div class="cover"></div>
        <div class="picwall">
            {{#> "picwall"}}
        </div>
    </div>
</div>

<div class="main_body">
    <div class="detailbox">
    {{#each $Cache.main.random_goods}}
        <div class="item">
            <div class="previewbox">
                <href to="/goods_details.html?id={{_id}}">
                    <img bind-src="{{preview_img_url}}?imageView/1/w/300/h/200" />
                </href>
            </div>
            <div class="contents">
                <div class="title">{{goods_name}}</div>
                <div class="content" style="color: red;">￥{{#Fixed price}}</div>
            </div>
        </div>
    {{/each}}
    </div>
</div>

<xmp type="template" name="picwall">
    <div class="inbox">
        {{#each bus_info.config.home_imgs}}
        <img bind-src="{{img_url}}?imageView/2/w/1200/h/400/q/99" />
        {{/each}}
    </div>
    {{#if bus_info.config.home_imgs.length>1}}
    <div class="select">
        <div class="selectbox">
        {{#each bus_info.config.home_imgs}}
            <div class="item {{($Top.$Cache.main.picwall_play_num==$Index)&&'focus'}}" data="$Index" event-click="{{'$Top.$Event.main.change_picwall_num'}}"></div>
        {{/each}}
        </div>
    </div>
    {{/if}}
    <script type="text/vm">
    function(vm) {
        var movebox = vm.queryElement({
            className: "inbox"
        })[0];
        require(["jQuery"], function($) {
            var $movebox = $(movebox);
            var imgs = $movebox.find("img");
            var len = imgs.length;
            var _i = 0;
            App.set("$Cache.main.picwall_play_num", 0);
            setInterval(function() {
                App.set("$Cache.main.picwall_play_num", _i % len);
                _x = "translateX(-" + ((_i % len) * 100) + "%)";
                $movebox.css({
                    transform: (_x),
                    "-webkit-transform": (_x)
                });
                _i += 1;
            }, 12000);
            vm.set("$Event.main.change_picwall_num", function(e, cvm) {
                _i = cvm.get("$Index");
                App.set("$Cache.main.picwall_play_num", _i % len);
                 _x = "translateX(-" + ((_i % len) * 100) + "%)";
                $movebox.css({
                    transform: (_x),
                    "-webkit-transform": (_x)
                });
            });
        });
    }
    </script>
</xmp>
